package com.sdcqjy.property.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sdcqjy.mylibrary.adapter.SuperRecyclerAdapter;
import com.sdcqjy.mylibrary.widget.photoView.RoundedImageView;
import com.sdcqjy.property.R;
import com.sdcqjy.property.mode.CommentMode;
import com.sdcqjy.property.utils.GlideUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by 磁磁帅 on 2018/4/14.
 * 功能：
 */
public class CommentAdapter extends SuperRecyclerAdapter<CommentMode> {
    public CommentAdapter(Context context, List<CommentMode> modeList) {
        super(context, modeList);
    }

    public int getLayoutId() {
        return R.layout.item_comment;
    }

    public SuperRecyclerAdapter.ViewHolder<CommentMode> getViewHolder(View view) {
        return new ViewHolder(view);
    }

    public class ViewHolder extends SuperRecyclerAdapter.ViewHolder<CommentMode> implements View.OnClickListener {
        @BindView(R.id.icon)
        RoundedImageView icon;
        @BindView(R.id.textName)
        TextView textName;
        @BindView(R.id.textContent)
        TextView textContent;
        @BindView(R.id.textTime)
        TextView textTime;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
            view.setOnClickListener(this);
        }

        public void setData(CommentMode mode) {
            super.setData(mode);
            textName.setText(mode.userName);
            textContent.setText(mode.comment);
            textTime.setText(mode.getTime());
            GlideUtils.displayOfUrl(context, icon, mode.headImageUrl);
        }

        public void onClick(View v) {
        }
    }
}
